package top.wangjiu.reactive.rpc.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.net.InetSocketAddress;

/**
 * @ClassName ServiceAddress
 * @Description TODO
 * @Author wangjiu
 * @Date 2021/7/15 6:06 下午
 */
@Getter
@AllArgsConstructor
public class ServiceAddress {

    private final Class service;

    private final int version;

    private final InetSocketAddress address;

    @Override
    public boolean equals(Object obj){
        if(obj instanceof ServiceAddress){
            ServiceAddress other = (ServiceAddress)obj;
            return service.equals(other.getService()) && other.version == version && address.equals(other.address);
        }
        return false;
    }
}
